﻿
namespace MITC.Portal.Core.Entitys.Configuration.LayoutsConfg
{
    #region refer
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;

    using Mitc.Portal2010.Core.Entity.ConfigWebpart;
    using SPGenesis.Core;
    using Mitc.Portal.Core.CoreHelper;

    #endregion

    [SPGENListInstance(
        WebRelURL = "Lists/LayoutConfig",
        Title = "LayoutConfig",
        OnQuickLaunch = false,
        TemplateType = (int)SPListTemplateType.GenericList)]
    public class LayoutIntance : SPGENListInstance<LayoutIntance>
    {
        protected override void InitializeDefinition(SPGENListInstanceProperties properties)
        {
            properties.Fields.ProvisioningMode = SPGENProvisioningMode.ExclusiveAdd;
            properties.Fields.Add<PositionContent>(true, false);
            properties.Fields.Add<UrlContent>(true, false);
            properties.Fields.Add<Tabship>(true, false);
            properties.Fields.Add<LoadSubContent>(true, false);
            properties.Fields.Add<TableColumn>(true, false);
            properties.Fields.Add<PlaceHolderId>(true, false);
            properties.Fields.Add<ContentHtml>(true, false);
            properties.Fields.Add<FixPosition>(true, false);
            properties.Fields.Add<PositionFixed>(true, false);
        }

        [SPGENField(AllowMultipleValues = false, ID = "{D9250DC7-993E-4788-A06E-159C8050B889}", DisplayName = "Position", Type = SPFieldType.Text, Required = false)]
        public class PositionContent : SPGENField<PositionContent, SPFieldText, string>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{F27322EE-97EE-4C69-9255-25B59F0840D2}", DisplayName = "UrlContent", Type = SPFieldType.Text, Required = false)]
        public class UrlContent : SPGENField<UrlContent, SPFieldText, string>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{EDBFF918-B6A6-474E-9306-A8D50A39D8AC}", DisplayName = "Tabship", Type = SPFieldType.Boolean, Required = false)]
        public class Tabship : SPGENField<Tabship, SPFieldBoolean, bool>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{208F213D-766A-4F86-A1AD-B9FC0FEED1E1}", DisplayName = "LoadSubContent", Type = SPFieldType.Boolean, Required = false)]
        public class LoadSubContent : SPGENField<LoadSubContent, SPFieldBoolean, bool>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{9C0ABFF6-8A43-4F47-8C4D-BBD9677AF847}", DisplayName = "TableColumn", Type = SPFieldType.Boolean, Required = false)]
        public class TableColumn : SPGENField<TableColumn, SPFieldBoolean, bool>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{7873C004-B887-4D2A-83E2-B7706099FCB9}", DisplayName = "TableColumn", Type = SPFieldType.Boolean, Required = false)]
        public class PositionFixed : SPGENField<PositionFixed, SPFieldBoolean, bool>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{1165444D-B328-4F09-83EA-C39692FA7E5B}", DisplayName = "PlaceHolderId", Type = SPFieldType.Text, Required = false)]
        public class PlaceHolderId : SPGENField<PlaceHolderId, SPFieldText, string>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{2DB2BCD1-9268-42DC-80A1-D63A6CE5282D}", DisplayName = "ContentHtml", Type = SPFieldType.Note, Required = false)]
        public class ContentHtml : SPGENField<ContentHtml, SPFieldMultiLineText, String>
        {
        }

        [SPGENField(AllowMultipleValues = false, ID = "{DB67D29E-C8E0-4FCE-83B7-4018797BF555}", DisplayName = "FixPosition", Type = SPFieldType.Choice, Required = false)]
        public class FixPosition : SPGENField<FixPosition, SPFieldChoice, string>
        {
            protected override void InitializeDefinition(SPGENFieldProperties<SPFieldChoice> properties)
            {
                properties.ChoiceMappings.Clear();

                properties.ChoiceMappings.Add("0", StringHelper.GetDescriptionEnum(FixedPosition.Banner));
                properties.ChoiceMappings.Add("1", StringHelper.GetDescriptionEnum(FixedPosition.Navigator));
                properties.ChoiceMappings.Add("2", StringHelper.GetDescriptionEnum(FixedPosition.Leftcolumn));
                properties.ChoiceMappings.Add("3", StringHelper.GetDescriptionEnum(FixedPosition.Rightcolumn));
                properties.ChoiceMappings.Add("4", StringHelper.GetDescriptionEnum(FixedPosition.Content));
                properties.ChoiceMappings.Add("5", StringHelper.GetDescriptionEnum(FixedPosition.Footer));
                properties.DefaultValue = StringHelper.GetDescriptionEnum(FixedPosition.Banner);
            }
        }
    }
}